const express = require('express')
const mysql = require('mysql')
const app = express()
const port = 3000
// 连接数据库
const connection = mysql.createConnection({
    host: 'localhost',
    port: 3306,    // 数据库默认端口3306
    user: 'root',
    password: 'root',
    database: 'wms'
})
connection.connect()
// 审批管理
app.get('/', (req, res) => {
    connection.query('select * from approvemanagement;', (err, rows) => {
        res.send({ data: rows })
    })
})
// 收发货
app.get('/receivetask', (req, res) => {
    connection.query('select * from receivetask;', (err, rows) => {
        res.send({ data: rows })
    })
})

app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})